// 数据字典
<template>
   <el-row style="background-color:#f2f2f2;min-height:calc(100vh - 140px);" class="grid">
     <el-col :span="24" >
       <TopMenu @handleActivety="handleClick" @handleDerive="handleDerive" />
     </el-col>
     <el-col :span="4" class="pdLR10" style="background:#fff;min-height:calc(100vh - 140px);">
       <div v-show="activeName == 1" class="tree-container" style="min-height:calc(100vh - 150px);overflow:auto;">
        <el-tree  :default-expanded-keys="[1]" :default-checked-keys="[80,1]"  node-key="id" :data="data" :props="defaultPropsThree" @node-click="handleNodeClick"></el-tree>
       </div>
       <div v-show="activeName == 2"  class="tree-container" style="min-height:calc(100vh - 150px);overflow:auto;">
         <el-tree  :default-expanded-keys="[1]" :default-checked-keys="[2]"  node-key="id" :data="dataOne" :props="defaultPropsThree" @node-click="handleNodeClickOne"></el-tree>
       </div>
       <div v-show="activeName == 3"  class="tree-container" style="height:calc(100vh - 150px);overflow:auto;">
         <el-tree  :default-expanded-keys="[1]" :default-checked-keys="[2]"  node-key="id" :data="treeData" :props="defaultProps" @node-click="handleNodeClickThree"></el-tree>
       </div>
     </el-col>
      
     <el-col :span="20" v-if="activeName == 1 || activeName == 2" style="padding:0 10px;;background:#fff;min-height:calc(100vh - 150px)"> 
       <el-col :span="24" style="border:1px solid #f2f2f2;padding:10px;display:flex;">
          <el-col :span="24" style="display:flex;">
             <el-col :span="6" v-if="drugType != 20">
                <el-col :span="4" style="height:35px;line-height:35px;" class="fontSize">名称</el-col>
                <el-col :span="20"><el-input v-model="keyvalue" :placeholder="placeholderContent" size="small"></el-input></el-col>
              </el-col>
              <el-col :span="6" style="paddingLeft:10px;" v-if="drugType != 13 && drugType != 14 && drugType != 16 && drugType != 17&& drugType!=19&& drugType!=20 ">
                <label style="marginRight:20px;" class="fontSize">状态</label>
                <el-select v-model="keyValueSelect" size="small"  placeholder="请选择状态">
                    <el-option
                      v-for="item in keyOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
              </el-col>
              <el-col :span="6" style="paddingLeft:10px;" v-if="drugType == 9">
                <el-col :span="16">
                  <el-select v-model="category_id" placeholder="请选择费用种类" size="small">
                    <el-option
                      v-for="item in serviceOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                    </el-option>
                  </el-select>
                </el-col>
              </el-col>
              <el-col :span="6" style="paddingLeft:10px;">
                <el-button size="small" v-if="drugType != 20" type="primary" @click="() =>{page = 1,tableData = [],tabData = [],gdetCategoryIndex()}">查询</el-button>
                <el-button size="small" v-if="drugType != 20" type="danger" @click="() =>{page = 1,keyvalue = '',category_id = '',keyValueSelect = '',tableData = [],tabData = [],gdetCategoryIndex()}">重置</el-button>
                <el-button size="small" type="primary" @click="handleAdd" v-if="this.drugType!='b3'">新增</el-button> 
              </el-col>
              <el-col :span="6">
                <el-button size="small" v-if="drugType == 5 || drugType == 6 || drugType == 9" type="primary" @click="handleCtalog">目录对照上传</el-button>
                <el-button size="small" v-if="drugType == 5 || drugType == 6 || drugType == 9" type="danger" @click="handleRepeal">目录对照撤销</el-button>
              </el-col>
          </el-col>
       </el-col> 
       <el-col :span="24">
        <FromList v-if="drugType != 5 && drugType != 9 && drugType != 6&& drugType != 21&& drugType != 'b3'&& drugType != 'b4'"  @handleEdit="handleEdit" @handleSwitchChange="handleSwitchChange" :tableData="tableData" :tableTitle="tableTitle" />
        <FromList :typeCheckbox="true" v-if="drugType == 5 || drugType == 9 || drugType == 6|| drugType == 21" @handleEdit="handleEdit" @handleSwitchChange="handleSwitchChange" @handelChange="handleTypeCheckBox" :tableData="tabData" :tableTitle="tabList" />
        <FromList v-if="drugType == 'b3' ||drugType == 'b4'" @handleEdit="handleEdit" @handleSwitchChange="handleSwitchChange" :tableData="tableData" :tableTitle="tableTitleBai" />
        <el-col v-if="drugType!=19&&drugType!=20" :span="24" style="margin:20px 0;text-align:center;">
            <el-pagination
            background
            @size-change="handleSizeChange"
            :current-page="page"
            :page-sizes="[10, 20, 30, 100]"
            :page-size="limit"
            layout="sizes , total , prev, pager, next , jumper"
            @current-change="handlePagination"
            :total="userCount">
            </el-pagination>
        </el-col>
       </el-col>
     </el-col>

     <el-col :span="20" v-if="activeName == 3" style="padding:10px 10px;;background:#fff;min-height:calc(100vh - 140px);">
      <el-col :span="24" style="border:1px solid #f2f2f2;padding:10px;display:flex;">
        <el-col :span="24" style="display:flex;">
            <el-col>
              <el-col :span="4" style="height:40px;line-height:40px;" class="fontSize">名称</el-col>
              <el-col :span="20"><el-input v-model="keyvalue" :placeholder="placeholderContent"></el-input></el-col>
            </el-col>
            <el-col  style="paddingLeft:10px;">
              <el-button type="primary" @click="handleInquire">查询</el-button>
              <el-button type="primary" @click="handleAddOne">新增</el-button>
              <!-- <el-button type="danger" @click="handle">重置</el-button> -->
            </el-col>
        </el-col>
      </el-col>
      <el-col :span="24" style="marginTop:10px;">
        <FromList @handleEdit="handleEditOne" :tableData="tableDataThree" :tableTitle="tableTitleThree" />
        <!-- <el-col :span="24" style="margin:20px 0;text-align:center;"> -->
            <!-- <el-pagination
            background
            @size-change="handleSizeChangeThree"
            :current-page="threePage"
            :page-sizes="[10, 20, 30, 100]"
            :page-size="threeLimit"
            layout="sizes , total , prev, pager, next , jumper"
            @current-change="handlePaginationThree"
            :total="userCount">
            </el-pagination> -->
        <!-- </el-col> -->
      </el-col>
     </el-col>
     <!-- 默认弹框内容 -->
      <el-dialog :close-on-click-modal='false'
        :title="dialogTitle"
        :visible.sync="classify"
        width="60%"
        :before-close="handleClose">
        <span>
          {{titleLabel}}
          <el-input style="marginTop:10px;" v-model="classIfyValue" placeholder="请输入要修改的名称"></el-input>
          <!-- 药房类型 -->
          <el-col :span="24" style="marginTop:10px;" v-if="drugType == 8">
            {{titleSelectLabel}}
          </el-col>  
          <el-select style="marginTop:10px;" v-model="classSelect" v-if="drugType == 8" placeholder="请选择药房类型" >
            <el-option
              v-for="item in pharmacy"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <!-- 费用类型 -->
          <el-col :span="24" style="marginTop:10px;" v-if="drugType == 10">
            {{titleSelectLabel}}
          </el-col>  
          <el-select v-model="pharmacySelect"  style="marginTop:10px;" v-if="drugType == 10" placeholder="请选择费用类型" >
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </span>
        <span slot="footer" class="dialog-footer">
          <el-button @click="classify = false">取 消</el-button>
          <el-button type="primary" @click="addClick">{{classifyType == 1 ? '添 加' : '保 存'}}</el-button>
        </span>
      </el-dialog>
      <!-- 添加编辑频次 -->
      <el-dialog :close-on-click-modal='false'
        :title="common == 1 ? '添加频次': '编辑频次'"
        :visible.sync="commonFlag"
        width="30%"

        :before-close="handleCloseCommnt">
        <span>
          <el-form :inline="false" :model="commonValue"  class="demo-form-inline">
            <el-col :span="24">
              <el-col :span="11">
                <el-form-item label="频次名称">
                  <el-input v-model="commonValue.name" placeholder="请输入频次名称"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" :offset="1">
                <el-form-item label="执行次数">
                  <el-input v-model="commonValue.number" placeholder="请输入执行次数"></el-input>
                </el-form-item>
              </el-col>
              
            </el-col>
            <el-col :span="24">
              <el-col :span="11">
                <el-form-item label="周期">
                  <el-input v-model="commonValue.zq" placeholder="请输入周期数"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" :offset="1">
                <el-form-item label="周期单位">
                  <el-select style="width:100%;"  v-model="commonValue.unit" placeholder="请选择周期单位" >
                    <el-option
                      v-for="item in TimeOption"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-form-item label="备注">
                <el-input type="textarea" v-model="commonValue.remark"></el-input>
              </el-form-item>
            </el-col>
          </el-form>
        </span>
        <span slot="footer" class="dialog-footer">
          <el-button @click="commonFlag = false">取 消</el-button>
          <el-button type="primary" @click="handleCommonAdd">{{common == 1 ? '添 加' : '保 存'}}</el-button>
        </span>
      </el-dialog>
      <!-- 添加项目字典 -->
      <el-dialog :close-on-click-modal='false'
        :title="projectFType == 1 ? '添加项目字典': '编辑项目字典'"
        :visible.sync="projectFlag"
        class="add"
        top="0"
       :fullscreen="true"
        :before-close="handleCloseProject">
        <span>
          <el-form :inline="false" :model="projectData" priceref="projectData"   class="demo-form-inline">
            <el-col :span="24" class="flexBetween">
              <el-col :span="5">
                <el-form-item label="项目名称"  :rules="[{ required: true, message: '项目名称不能为空'},]">
                  <el-input v-model="projectData.name"  placeholder="请输入项目名称"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="费用类型" :rules="[{ required: true, message: '费用类型不能为空'},]">
                  <el-select style="width:100%;"  v-model="projectData.category_id" placeholder="请选择费用类型" >
                    <el-option
                      v-for="item in serviceOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="单位" :rules="[{ required: true, message: '单位不能为空'}]">
                    <el-select style="width:100%;"  v-model="projectData.unit" placeholder="请选择单位类型" >
                      <el-option
                        v-for="item in unitOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1"> 
                <el-form-item label="价格" prop="" :rules="[{ required: true, message: '价格不能为空'},{ type: 'number', message: '价格必须为数字'}]">
                  <el-input v-model="projectData.price" placeholder="请输入价格" type="number"></el-input>
                </el-form-item>
              </el-col>
            </el-col>
            <el-col :span="24" class="flexBetween">
              <el-col :span="5">
                <el-form-item label="类型" :rules="[{ required: true, message: '类型不能为空'},]">
                  <el-select style="width:100%;"  v-model="projectData.type" placeholder="请选择类型" >
                    <el-option
                      v-for="item in projectDataType"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="检测标本">
                  <el-input v-model="projectData.check_sample" placeholder="请输入检测标本"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="地方项目代码">
                  <el-input v-model="projectData.local_code" placeholder="请输入地方项目代码"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="地方项目名称">
                  <el-input v-model="projectData.local_name" placeholder="请输入地方项目名称"></el-input>
                </el-form-item>
              </el-col>
            </el-col>
            <el-col :span="24" class="flexBetween">
              <!-- <el-col :span="5" > 
                <el-form-item label="医保类型">
                  <el-select style="width:100%;"  v-model="projectData.yb_type" placeholder="请选择医保类型" >
                    <el-option
                      v-for="item in yb_typeOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col> -->
              <el-col :span="5" :offset="1">
                <el-form-item label="医保名称">
                  <el-input v-model="projectData.yb_name" disable placeholder="请输入医保名称"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="医保比例">
                  <el-input v-model="projectData.yb_proportion" disable placeholder="请输入医保比例"></el-input>
                </el-form-item>
              </el-col>
             <el-col :span="5" :offset="1"> 
                <el-form-item label="医保编号">
                  <el-input v-model="projectData.yb_code" disable="true" placeholder="请输入医保编号"></el-input>
                </el-form-item>
              </el-col>
            </el-col>
            <el-col :span="24"  class="flexBetween">
              <el-col :span="5">
                <el-form-item label="执行科室">
                 <choiceCascader @cascaderChange="cascaderChange" :value="proJectSelectId" />
                </el-form-item>
              </el-col>
              
              <el-col :span="5" :offset="1">
                <!-- <el-form-item label="地方项目名称">
                  <el-input v-model="projectData.local_name" placeholder="地方项目名称"></el-input>
                </el-form-item> -->
              </el-col>
              <el-col :span="5" :offset="1">
                <!-- <el-form-item label="地方项目名称">
                  <el-input v-model="projectData.local_name" placeholder="地方项目名称"></el-input>
                </el-form-item> -->
              </el-col>
              <el-col :span="5" :offset="1">
                <!-- <el-form-item label="地方项目名称">
                  <el-input v-model="projectData.local_name" placeholder="地方项目名称"></el-input>
                </el-form-item> -->
              </el-col>
            </el-col>
            <el-col :span="24" >
              <el-form-item label="项目内涵">
                <el-input  type="textarea"  v-model="projectData.description" placeholder="请输入项目内涵"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24" >
              <el-form-item label="除外内容">
                <el-input  type="textarea"  v-model="projectData.chuwai" placeholder="请输入除外内容"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24" >
              <el-form-item label="说明" >
                <el-input  type="textarea"  v-model="projectData.remark" placeholder="请输入说明"></el-input>
              </el-form-item>
            </el-col>
          </el-form>
        </span>
        <!-- <el-col :span="5" :offset="1">
                <el-form-item label="执行科室">
                  <el-select style="width:100%;"  v-model="projectData.make_dept" placeholder="请选择周期单位" >
                    <el-option
                      v-for="item in TimeOption"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col> -->
        <span slot="footer" class="dialog-footer">
          <el-button @click="projectFlag = false">取 消</el-button>
          <el-button type="primary" @click="handleProjectAdd">{{projectFType == 1 ? '添 加' : '保 存'}}</el-button>
        </span>
      </el-dialog>
      <!-- 添加药品信息 -->
      <div class="fixed"> 
         <el-dialog :close-on-click-modal='false'
          :title="informationType == 1 ? '添加药品信息': '编辑药品信息'"
          :visible.sync="informationFlag"
          top="0"
          :fullscreen="true"
          :before-close="handleCloseInformation">
          <span>
            <el-form :inline="false" :model="information"  class="demo-form-inline heightOvhider">
              <el-col :span="24" class="flexBetween">
                <el-col :span="4">
                  <el-form-item label="药品名称"  :rules="[{ required: true, message: '药品名称不能为空'},]">
                    <el-input v-model="information.name"  placeholder="请输入药品名称"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4"> 
                  <el-form-item label="药品种类" :rules="[{ required: true, message: '药品种类不能为空'},]">
                    <el-select style="width:100%;"  v-model="information.species_id" placeholder="请选择药品种类" >
                      <el-option
                        v-for="item in kindType"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="药品分类" :rules="[{ required: true, message: '药品分类不能为空'}]">
                    <el-select style="width:100%;"  v-model="information.category_id" placeholder="请选择药品分类" >
                      <el-option
                        v-for="item in drugClassFly"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4"> 
                  <el-form-item label="费用分类" :rules="[{ required: true, message: '费用分类不能为空'}]">
                    <el-select style="width:100%;"  v-model="information.fee_category_id" placeholder="请选择费用分类" >
                      <el-option
                        v-for="item in serviceOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="是否非处方药">
                    <el-select style="width:100%;"  v-model="information.is_otc" placeholder="请选择是否非处方药" >
                      <el-option
                        v-for="item in is_otcType"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24" class="flexBetween">
                <el-col :span="4">
                  <el-form-item label="是否皮试">
                    <el-select style="width:100%;"  v-model="information.is_skin_test" placeholder="请选择是否皮试" >
                      <el-option
                        v-for="item in is_skin_test"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4"> 
                  <el-form-item label="价格" prop="" :rules="[{ required: true, message: '价格不能为空'},{ type: 'number', message: '价格必须为数字'}]">
                    <el-input v-model="information.price" placeholder="请输入价格" type="number"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="规格" :rules="[{ required: true, message: '规格不能为空'},]">
                    <el-input v-model="information.specification" placeholder="请输入规格"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="剂量单位">
                    <el-select style="width:100%;"  v-model="information.dose_unit" placeholder="请选择剂量单位" >
                      <el-option
                        v-for="item in doseUnitOptions"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="最小剂量数" :rules="[{ required: true, message: '剂量数不能为空'},]">
                    <el-input v-model="information.dose" placeholder="请输入最小剂量数" type="number"></el-input>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24" class="flexBetween">
                <el-col :span="4">
                  <el-form-item label="剂型">
                    <el-select style="width:100%;"  v-model="information.form_of_drug" placeholder="请选择剂型" >
                      <el-option
                        v-for="item in dosageOptions"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4" >
                  <el-form-item label="包装规格" :rules="[{ required: true, message: '包装规格不能为空'},]">
                    <el-select style="width:100%;"  v-model="information.pack_specification" placeholder="请选择包装规格" >
                      <el-option
                        v-for="item in pack_specificationType"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                   <el-form-item label="给药途径">
                    <el-select style="width:100%;"  v-model="information.usage" placeholder="请每次给药途径" >
                      <el-option
                        v-for="item in usageOptions"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="脚注">
                     <el-select style="width:100%;"  v-model="information.usage_extra" placeholder="请选择脚注" >
                      <el-option
                        v-for="item in footnoteOptions"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4" >
                  <el-form-item label="用量">
                    <el-input v-model="information.each_dos" placeholder=""></el-input>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24" class="flexBetween">
                <el-col :span="4">
                  <el-form-item label="使用频次">
                    <el-select style="width:100%;"  v-model="information.used_frqu" placeholder="请选择使用频次" >
                      <el-option
                        v-for="item in frequencyOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="有效期" >
                    <el-date-picker type="date" placeholder="选择日期" v-model="information.term_of_validity" style="width: 100%;"></el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="条形码">
                    <el-input v-model="information.bar_code" placeholder="请输入条形码"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="国药准字">
                    <el-input v-model="information.drug_code" placeholder="请输入国药准字"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4" >
                  <el-form-item label="药监局码">
                    <el-input v-model="information.drug_admin_code" placeholder="请输入药监局码"></el-input>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24" class="flexBetween">
                <el-col :span="4">
                  <el-form-item label="医保编号">
                    <el-input v-model="information.yb_code" placeholder="请输入医保编号"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="医保名称" >
                    <el-input v-model="information.yb_name" placeholder="请输入医保名称"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="医保比例">
                    <el-input v-model="information.yb_proportion" placeholder="请输入医保比例"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="医保类型">
                    <el-input v-model="information.yb_type" placeholder="请输入医保类型"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4" >
                  <el-form-item label="功能主治">
                    <el-input v-model="information.function" placeholder="请输入功能主治"></el-input>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24" class="flexBetween">
                <!-- <el-col :span="4">
                  <el-form-item label="最小使用单位">
                    <el-input v-model="information.min_useunt" placeholder="请输入最小使用单位"></el-input>
                  </el-form-item>
                </el-col> -->
                <!-- <el-col :span="4">
                  <el-form-item label="最小销售单位" >
                    <el-input v-model="information.min_salunt" placeholder="请输入最小销售单位"></el-input>
                  </el-form-item>
                </el-col> -->
                <el-col :span="4">
                  <el-form-item label="拆包系数">
                    <el-input v-model="information.min_pac_cnt" placeholder="请输入拆包系数"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                   <el-form-item label="最小包装单位">
                    <el-select style="width:100%;"  v-model="information.min_pacunt" placeholder="请选择最小包装单位" >
                      <el-option
                        v-for="item in minPackOptions"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                   <el-form-item label="销售单位">
                    <el-select style="width:100%;"  v-model="information.base_unit" placeholder="请选择销售单位" >
                      <el-option
                        v-for="item in minPackOptions"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4" >
                  <el-form-item label="最小制剂单位">
                    <el-select style="width:100%;"  v-model="information.min_prepunt" placeholder="请选择最小制剂单位" >
                      <el-option
                        v-for="item in preparationOptions"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                 
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="药品本位码" >
                    <el-input v-model="information.drugstdcode" placeholder="请输入药品本位码"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="精神药物等级" >
                    <el-select style="width:100%;"  v-model="information.spirit" placeholder="请选择精神药物等级" >
                      <el-option
                        v-for="item in spiritOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24" class="flexBetween">
                <!-- <el-col :span="4">
                  <el-form-item label="最小计价单位">
                    <el-input v-model="information.min_prcunt" placeholder="请输入最小计价单位"></el-input>
                  </el-form-item>
                </el-col> -->
                
               
                <el-col :span="4">
                  <el-form-item label="处方等级" >
                    <el-select style="width:100%;"  v-model="information.prescription" placeholder="请选择处方等级" >
                      <el-option
                        v-for="item in prescriptionOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="抗菌药物等级" >
                    <el-select style="width:100%;"  v-model="information.antibiosis" placeholder="请选择抗菌药物等级" >
                      <el-option
                        v-for="item in antibiosisOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="毒麻药物等级" >
                    <el-select style="width:100%;"  v-model="information.narcotic" placeholder="请选择毒麻药物等级" >
                      <el-option
                        v-for="item in narcoticOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="贵重药物等级" >
                    <el-select style="width:100%;"  v-model="information.precious" placeholder="请选择贵重药物等级" >
                      <el-option
                        v-for="item in preciousOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="服务对象" >
                    <el-select style="width:100%;"  v-model="information.service_for" placeholder="请选择服务对象" >
                      <el-option
                        v-for="item in service_forOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24" class="flexBetween">
                
                <el-col :span="4">
                  <el-form-item label="生产企业" >
                    <el-input v-model="information.origin_factory" placeholder="请输入生产企业"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                </el-col>
              </el-col>
              <el-col :span="24" >
                <el-form-item label="说明书">
                  <el-input  type="textarea"  v-model="information.manual" placeholder="请输入说明书"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24" >
                <el-form-item label="备注" >
                  <el-input  type="textarea"  v-model="information.remark" placeholder="请输入备注"></el-input>
                </el-form-item>
              </el-col>
            </el-form>
          </span>
          <span slot="footer" class="dialog-footer">
            <el-button @click="()=>{informationFlag = false,page = 1,limit = 10}">取 消</el-button>
            <el-button type="primary" @click="handleInformationType">{{informationType == 1 ? '添 加' : '保 存'}}</el-button>
          </span>
        </el-dialog>
      </div>
      <!-- 添加卫材 -->
         <el-dialog :close-on-click-modal='false'
        :title="projectFType == 1 ? '添加卫材字典': '编辑卫材字典'"
        :visible.sync="projectFlag2"
        class="add"
        top="0"
        :fullscreen="true"
>
        <span>
          <el-form :inline="false" :model="projectData" priceref="projectData"   class="demo-form-inline">
            <!-- <el-col :span="24" class="flexBetween"> -->
              <el-col :span="5">
                <el-form-item label="卫材名称"  :rules="[{ required: true, message: '项目名称不能为空'},]">
                  <el-input v-model="projectData.name"  placeholder="请输入卫材名称"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="费用类型" :rules="[{ required: true, message: '费用类型不能为空'},]">
                  <el-select style="width:100%;"  v-model="projectData.category_id" placeholder="请选择费用类型" >
                    <el-option
                      v-for="item in serviceOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
                 <el-col :span="5" :offset="1">
                <el-form-item label="规格" :rules="[{ required: true, message: '规格不能为空'},]">
                  <el-input v-model="projectData.specification" placeholder="请输入规格"></el-input>
                </el-form-item>
              </el-col>
                 <el-col :span="5" :offset="1">
                            <el-form-item label="包装规格" :rules="[{ required: true, message: '包装规格不能为空'},]">
                    <el-select style="width:100%;"  v-model="projectData.pack_specification" placeholder="请选择包装规格" >
                      <el-option
                        v-for="item in pack_specificationType"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
              </el-col>
              <!-- <el-col :span="5" :offset="1">
                <el-form-item label="单位" :rules="[{ required: true, message: '单位不能为空'}]">
                    <el-select style="width:100%;"  v-model="projectData.unit" placeholder="请选择单位类型" >
                      <el-option
                        v-for="item in unitOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                </el-form-item>
              </el-col> -->
              <!-- <el-col :span="5" :offset="1"> 
                <el-form-item label="价格" prop="" :rules="[{ required: true, message: '价格不能为空'},{ type: 'number', message: '价格必须为数字'}]">
                  <el-input v-model="projectData.price" placeholder="请输入价格" type="number"></el-input>
                </el-form-item>
              </el-col> -->
            <!-- </el-col> -->
            <!-- <el-col :span="24" class="flexBetween"> -->
              <!-- <el-col :span="5">
                <el-form-item label="类型" :rules="[{ required: true, message: '类型不能为空'},]">
                  <el-select style="width:100%;"  v-model="projectData.type" placeholder="请选择类型" >
                    <el-option
                      v-for="item in projectDataType"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col> -->
           
              <!-- <el-col :span="5" :offset="1">
                                 <el-form-item label="剂型">
                    <el-select style="width:100%;"  v-model="projectData.form_of_drug" placeholder="请选择剂型" >
                      <el-option
                        v-for="item in dosageOptions"
                        :key="item.name"
                        :label="item.name"
                        :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
              </el-col> -->
           
            <!-- </el-col> -->
            <!-- <el-col :span="24" class="flexBetween"> -->
              <!-- <el-col :span="5" > 
                <el-form-item label="医保类型">
                  <el-select style="width:100%;"  v-model="projectData.yb_type" placeholder="请选择医保类型" >
                    <el-option
                      v-for="item in yb_typeOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col> -->
              <!-- <el-col :span="5" :offset="1">
                <el-form-item label="医保名称">
                  <el-input v-model="projectData.yb_name" disable placeholder="请输入医保名称"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" :offset="1">
                <el-form-item label="医保比例">
                  <el-input v-model="projectData.yb_proportion" disable placeholder="请输入医保比例"></el-input>
                </el-form-item>
              </el-col>
             <el-col :span="5" :offset="1"> 
                <el-form-item label="医保编号">
                  <el-input v-model="projectData.yb_code" disable="true" placeholder="请输入医保编号"></el-input>
                </el-form-item>
              </el-col> -->
            <!-- </el-col> -->
     
           
          </el-form>
        </span>
        <!-- <el-col :span="5" :offset="1">
                <el-form-item label="执行科室">
                  <el-select style="width:100%;"  v-model="projectData.make_dept" placeholder="请选择周期单位" >
                    <el-option
                      v-for="item in TimeOption"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col> -->
        <span slot="footer" class="dialog-footer">
          <el-button @click="projectFlag2 = false">取 消</el-button>
          <el-button type="primary" @click="material_dict_save">{{projectFType == 1 ? '添 加' : '保 存'}}</el-button>
        </span>
      </el-dialog>
      <!-- 添加诊断字典 -->
      <el-dialog :close-on-click-modal='false'
        :title="diagnoseType == 1 ? '添加诊断字典': '编辑诊断字典'"
        :visible.sync="diagnoseFlag"
        
        width="30%"
        :before-close="handleClosediagnose">
        <span>
          <el-form :inline="false" :model="diagnoseData"  class="demo-form-inline">
            <el-col :span="24">
              <el-col :span="11">
                <el-form-item label="诊断代码">
                  <el-input v-model="diagnoseData.code" placeholder="请输入诊断代码"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12" :offset="1">
                <el-form-item label="诊断名称">
                  <el-input v-model="diagnoseData.name" placeholder="请输入诊断名称"></el-input>
                </el-form-item>
              </el-col>
              
            </el-col>
            <el-col :span="24">
                <el-form-item label="诊断分类">
                  <el-input v-model="diagnoseData.category" placeholder="请输入诊断分类"></el-input>
                </el-form-item>
            </el-col>
          </el-form>
        </span>
        <span slot="footer" class="dialog-footer">
          <el-button @click="diagnoseFlag = false">取 消</el-button>
          <el-button type="primary" @click="dict_dataSaveDiseaseDict">{{diagnoseType == 1 ? '添 加' : '保 存'}}</el-button>
        </span>
      </el-dialog>
      <!-- 添加基础字典值 -->
      <el-dialog :close-on-click-modal='false'
      :title="threeType == 1 ? '添加基础字典': '编辑基础字典'"
      :visible.sync="threeFlag"
      width="50%"
      :before-close="handleCloseThree">
      <span>
        <el-form :inline="false" :model="threeFrom"  class="demo-form-inline">
          <el-col :span="24">
            <el-col :span="7">
              <el-form-item label="字典名称">
                <el-input v-model="threeFrom.name" placeholder="请输入字典名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="7" :offset="1">
              <el-form-item label="字典值">
                <el-input v-model="threeFrom.value" placeholder="请输入字典值"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="7" :offset="1">
              <el-form-item label="排序">
                <el-input v-model="threeFrom.listorder " placeholder="请输入排序值"></el-input>
              </el-form-item>
            </el-col>
          </el-col>
        </el-form>
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="threeFlag = false">取 消</el-button>
        <el-button type="primary" @click="handleAddThree">{{threeType == 1 ? '添 加' : '保 存'}}</el-button>
      </span>
      </el-dialog>
      <!-- 添加给药途径 -->
      <el-dialog :close-on-click-modal='false'
      title="给药途径操作"
      :visible.sync="routeType"
      width="30%"
      :before-close="handleCloseThree">
      <span>
        <el-form :inline="false" :model="routeForm"  class="demo-form-inline">
          <el-col :span="24">
            <el-col :span="11">
              <el-form-item label="给药途径名称">
                <el-input v-model="routeForm.name" placeholder="请输入给药途径名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12" :offset="1">
              <el-form-item label="请选择给药途径类型">
                  <el-select style="width:100%;"  v-model="routeForm.type" placeholder="请选择给药途径类型" >
                    <el-option
                      v-for="item in routeOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
              </el-form-item>
            </el-col>
          </el-col>
        </el-form>
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="routeType = false">取 消</el-button>
        <el-button type="primary" @click="handleAddRoute">确定</el-button>
      </span>
      </el-dialog>
        <!-- 组合项  添加 -->
      <el-dialog :close-on-click-modal='false'
      title="组合项"
      :visible.sync="zhxType"
    :fullscreen="true"
     :before-close="handleCloseThree2"
      >
      <span>
        <el-form :inline="false" :model="zhxForm"  class="demo-form-inline">
          <el-col :span="24">
            <el-col :span="11">
              <el-form-item label="组合项目名称">
                <el-input v-model="zhxForm.title" placeholder="组合项目名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12" :offset="1">
               <el-form-item label="组合项目备注">
                <el-input v-model="zhxForm.remark" placeholder="组合项目备注"></el-input>
              </el-form-item>
            </el-col>
           
              <el-col :span="24" >
               <el-form-item label="选择项目">
                             <div class="selects">
        <div class="selectTables" style="float: left">
          <el-popover placement="bottom-end" width="600px" trigger="focus">
            <el-input
              placeholder=""
              slot="reference"
              v-model="keyvalue"
              @input="service_feeServiceIndex()"
            >
              <i slot="suffix" class="el-input__icon el-icon-search"></i>
            </el-input>
     
            <el-table
              v-loading="threeSelectLoading"
              height="300"
              @row-click="xuanzeDatathree"
              :data="selectData1"
              style="width: 100%"
            >
              <el-table-column label="序号" prop="number" >
              </el-table-column>

             
              <el-table-column label="项目名称" prop="name" width="250" >
              </el-table-column>
               <el-table-column label="价格" prop="price">
              </el-table-column>
            </el-table>
          </el-popover>
        </div>
      </div>
              </el-form-item>
            </el-col>
      <el-table
           
              height="300"
         
              :data="selectData2"
              style="width: 100%"
            >
              <el-table-column label="序号" prop="number" >
              </el-table-column>

              <el-table-column label="国家项目代码" prop="yb_code" >
              </el-table-column>
             
              <el-table-column label="项目名称" prop="name" >
              </el-table-column>
                  <el-table-column label="价格" prop="price" >
              </el-table-column>
                <el-table-column fixed="right" label="操作" width="120">
                <template slot-scope="scope">
                  <el-button
                    @click.native.prevent="deleteRow(scope.$index, selectData2)"
                    type="text"
                    size="small"
                  >
                    移除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-col>
        </el-form>

      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="zhxType = false">取 消</el-button>
        <el-button type="primary" @click="handxmz">确定</el-button>
      </span>
      </el-dialog>
         <el-dialog :close-on-click-modal='false'
      title="组合项"
      :visible.sync="ybduima"
    :fullscreen="true"
    
      >
      <span>
        <costRecord/>
      </span>
      </el-dialog>
          <el-dialog :close-on-click-modal='false'
      title="添加计价"
      :visible.sync="JJType"
    :fullscreen="true"
     :before-close="handleCloseThree3"
      >
      <span>
        <cost/>
      </span>
     
      </el-dialog>
   </el-row>
</template>

<script>
import { Loading } from 'element-ui'; //项目已经全局引入element的话可以不单独引入
import {  
  getCategoryIndex,
  getCategorySet,
  getCategorySave,
  getCategoryDel,
  getDrugUnitIndex,
  getDrugUnitSet,
  getDrugSpeciesIndex,
  getDrugSpeciesSave,
  getDrugUnitSave,
  getDrugSpeciesSet,
  getDosageList,
  getDrug_channel,
  getDrug_storeIndex,
  getCommon,
  getDrug_house,
  getDrug_storeSave,
  getDrug_houseSave,
  getDrug_storeSetStatus,
  getDrug_houseSetStatus,
  getDosageCreate,
  getDosageUpdate,
  drug_channelCreate,
  drug_channelUpdate,
  commonCreatePinci,
  commonSavePinci,
  dosageDelete,
  dict_dataGetDiseaseDict,
  drugDrugIndex,
  dict_dataSetDiseaseDict,
  drug_channelDelete,
  drugDrugSave,
  service_feeCategoryIndex,
  service_feeCategorySave,
  service_feeCategorySet,
  getChronicDisease,
  getDiseaseSpecieDict,
  service_feeServiceIndex,
  service_feeSetService,
  service_feeSaveService,
  drugDrugSet,
  drugDrugDel,
  dict_dataSaveDiseaseDict,
  dict_dataDictIndex,
  drugDrugShow,
  dict_dataGroupIndex,
  dict_dataDel,
  dict_dataStore,
  dict_dataSave,
  drugExportDrug,
  service_feeExportService,
  upCateLog,
  backCateLog,
  deletePinci,
  drugUnitDel,
  drugSpeciesDel,
  categoryDel,
  doctor_entrustGetList,
  doctor_entrustSave,
  saveServiceGroup,
  deleteServiceGroup,
  getServiceGroup,
  getServiceGroupDetail,
  delService,
  doctor_entrustDelete,
  project_getList,
  project_save,
  project_delete,
  material_dict_index,
  material_dict_save,
  material_dict_unitDel,
  material_dict_del,
  material_dict_show,
  
  } from "@/api/dataDictionaries"
import {ypd,tabList,serveTitle,qita,yaopin,mzmtbTitle,bdffmlTitle,dictionary,yizhu,xmz,jjxm,weicai} from "./tabTitle"
import axios from 'axios'
import {http} from "@/utils/server.js"
import FromList from "@/forComponents/fromList/fromList"
import {handleGetServiceItem} from '@/api/outpatient'
import {objectValueAllEmpty} from "@/utils/ifObject"
import TopMenu from "@/components/TopMenu"
import choiceCascader from "@/components/choiceCascader"
import costRecord from "./components/costRecord.vue"
import cost from "./components/cost.vue"
export default {
   name:"dataDictionaries",
   data(){
     return {
       unitOptions:[],
       tableTitleBai:[],
       activeName:1,
       activeNames: ['1'],
       switchId:6,
       placeholderContent:"",
       routeType:false,
       ybduima:false,
       projectFlag2:false,
       routeForm:{
         name:"",
         type:"",
         id:"",
       },
        zhxForm:{
         title:"",
         remark:"",
         id:"",
         pid:'',
        
       },
       selectData1:[],
       routeFlag:1,
       routeOptions:[
         {
           label:"西药",
           value:1
         },
         {
           label:"中药",
           value:2
         },
         {
           label:"项目",
           value:3
         },
         {
           label:"通用",
           value:4
         },
       ],
       propsOne: { multiple: true },
       data: [
        {
          id:80,
          label: '药品管理',
          children: [
            {
              id:1,
              label: '药品单位',
            },
            {
              id:2,
              label: '药品种类',
            },
            {
              id:3,
              label: '药品分类',
            },
            {
              id:5,
              label: '药品信息',
            },
            {
              id:6,
              label: '耗材字典',
            }
          ]
        },
        {
          id:81,
          label: '库房管理',
          children: [{
            id:7,
            label: '库房字典',
            children: []
          },
          {
            id:8,
            label: '药房字典',
            children: []
          },
          ]
        },  
        {
          id:82,
          label: '项目管理',
          children: [{
            id:9,
            label: '项目字典',
            children: []
          },{
            id:19,
            label: '组合项目',
            children: []
          },
          {
            id:20,
            label: '计价项目',
            children: []
          }
          ]
        },
        {
          id:83,
          label: '财务管理',
          children: [{
            id:10,
            label: '费用种类',
            children: []
          },
          ]
        }, 
        {
          id:84,
          label: '其他',
          children: [
          {
            id:13,
            label: '剂型管理',
            children: []
          },
          {
            id:14,
            label: '给药途径',
            children: []
          },
          {
            id:16,
            label: '频次管理',
            children: []
          },
          {
            id:17,
            label: '医嘱术语',
            children: []
          },
           {
            id:21,
            label: '卫材管理',
            children: []
          }
          ]
        }, 
       ],
       dataOne:[
        {
          id:1,
          label: '诊断管理',
          children: [
            {
              id:2,
              label: '疾病代码ICD10 v2.0',
            },
            {
              id:'b3',
              label: '门诊慢特病',
            },
            {
              id:'b4',
              label: '病种付费目录',
            },
          ]
        },
       ],
       defaultProps: {
          children: 'children',
          label: 'name'
       },
       defaultPropsThree: {
          children: 'children',
       },
       options:[
        {
          value:1,
          label:"项目"
        },
        {
          value:2,
          label:"药品"
        },
        {
          value:3,
          label:"通用"
        }
       ],
       classSelect:"", //药品种类选择框
       pharmacy:[
        {
          value:1,
          label:"门诊药房"
        },
        {
          value:2,
          label:"住院药房"
        },
        {
          value:3,
          label:"统一药房"
        }
       ],
       pharmacySelect:"", //费用种类选择框
       category_id:"",
       tableTitle:[
          {
            prop:"number",
            name:"编码",
            type:1,
          },
          {
            prop:"name",
            name:"名称",
            type:1,
          },
          {
            prop:"company_id",
            name:"排序号",
            type:1,
          },
          {
            prop:"input",
            name:"拼音",
            type:1,
          },
          {
            prop:"created_at",
            name:"创建时间",
            type:1,
          },
          {
            prop:"status",
            name:"启用状态",
            type:5,
          },
          {
            prop:"",
            name:"操作",
            type:4,
            arr:[
            {
              type:"info",
              number:1,
              name:"编辑"
            },
            {
              type: "danger",
              number: 2,
              name: "删除"
            },
          ]
          },
       ],
       threeSelectLoading:false,
       JJType:false,
       tabList:tabList,
       tabData:[],
       typeData:"",
       tableData: [],
       selectData2:[],
       page:1,
       limit:10,
       keyword:"",
       drugType:1, //1药品单位 1icd10疾病 2药品种类 2肿瘤   3是药品分类 3中医 4药品类型 4其他 5药品信息 6药品规格 7库房字典 8项目字典 9 费用种类 10 财务科目 11供货单位 12 剂型管理 13给药途径 14煎服脚注 15 频次管理 16 产地管理 17货位管理 18 检查部位 19发票项目 
       classify:false,
       classIfyValue:"", //分类添加value
       keyvalue:"",
       classifyType:1,
       activityValue:"",
       species_id:"",
       userCount:0,
       common:1,
       commonFlag:false,
       dialogTitle:"",
       commonValue:{
        name:"",
        zq:"",
        number:"",
        unit:"",
        remark:""
       },
       TimeOption:[
        {
          value:1,
          label:"分钟"
        },
        {
          value:2,
          label:"小时"
        },
        {
          value:3,
          label:"天"
        },
        {
          value:4,
          label:"周"
        }
       ],
       titleLabel:"",
       keyValueSelect:"",
       keyOptions:[
         {
           label:"全部",
           value:""
         },
         {
           label:"启用",
           value:1
         },
         {
           label:"停用",
           value:2
         }
       ],
       InterfaceName:[{
        1:'getDrugUnitIndex',
        2:'getDrugSpeciesIndex',
        3:'getCategoryIndex',
        4:'getCategoryIndex',
        5:'drugDrugIndex',
        6:'drugDrugIndex',
        7:'getDrug_storeIndex',
        8:'getDrug_house',
        9:'service_feeServiceIndex',
        10:'service_feeCategoryIndex',
        13:'getDosageList',
        14:'getDrug_channel',
        15:'getDrug_channel',
        16:'getCommon',
        17:'doctor_entrustGetList',
        19:'getServiceGroup'
        },{
            2:'dict_dataGetDiseaseDict',
            'b3':'getChronicDisease',
            'b4':'getDiseaseSpecieDict',
       }],
       titleSelectLabel:"", //选择框名称
       projectFlag:false,
       projectData:{
         name:"",  //name项目名称
         category_id:"", //费用类型
         unit:"", //unit	单位  
         price:"",//价格
         type:"",//类型  @1 普通 @2 检查  @3 检验 @4 治疗 @5 手术
         check_sample:"", //检测标本
         make_dept:"", //执行科室   科室部门选择
         local_code:"",//地方项目代码
         local_name:"", //地方项目名称
         yb_code:"", //医保编号
         yb_name:"", //医保名称
         yb_proportion:"", //医保比例
         yb_type:"", //医保类型
         description:"", //项目内涵
         remark:"",  //说明
         chuwai:"",//除外内容

        
       },
       
    
       yb_typeOptions:[
         {
           value:1,
           label:"是"
         },
         {
           value:2,
           label:"否"
         }
       ],
       serviceOptions:[], //费用种类
        // @1 普通 @2 检查  @3 检验 @4 治疗 @5 手术
       projectDataType:[
         {
           value:1,
           label:"普通"
         },
         {
           value:2,
           label:"检查"
         },
         {
           value:3,
           label:"检验"
         },
         {
           value:4,
           label:"治疗"
         },
         {
           value:5,
           label:"手术"
         },
          {
           value:6,
           label:"量表"
         },
       ],
       
       projectFType:1,
       projectId:"", //编辑ID
       proJectSelectId:"",//  科室
       information:{
         name:"",//药品名称
         species_id:"", //药品种类id
         category_id:"", //药品分类id
         fee_category_id:"", //费用分类id
         is_otc:"", //是否非处方药 @1 是 @2 不是 
         is_skin_test:"", //是否皮试 @1 是 @2 否
         specification:"", //规格
         dose_unit:"", //剂量单位
         dose:"", //剂量数
         pack_specification:"", //包装规格
         form_of_drug:"", //剂型
         origin_factory:"", //生产企业
         usage:"", //用法
         usage_extra:"", //脚注
         each_dos:"", //每次用量
         used_frqu:"", //使用频次
         term_of_validity:"", //有效期
         bar_code:"", //条形码
         drug_code:"", //国药准字
         drug_admin_code:"", //药监局码
         drugstdcode:"", // 药品本位码
         yb_code:"", //医保编号
         yb_name:"", //医保名称
         yb_proportion:"",//医保比例
         yb_type:"", // 医保类型
         function:"", //功能主治
         manual:"", //说明书
         min_useunt:"", //最小使用单位
         min_salunt:"", //最小销售单位
         min_pac_cnt:"", //最小包装数量
         min_pacunt:"", //最小包装单位
         min_prepunt:"", // 最小制剂单位
         min_prcunt:"", //最小计价单位
         remark:"", //备注 
         service_for:"", //服务对象  @1 全部  @2 门诊 @3 住院
         prescription:"", //处方等级(数据字典) id 为 42
         antibiosis:"", //抗菌药物等级(数据字典) id为43
         spirit:"",  //精神药物等级  数据字典id为41
         narcotic:"", //毒麻药物等级 数据字典id 为44
         precious:"",  //贵重药物等级  数据字典id为45
         price:"", //价格
       },
       tableData2:[],
       service_forOptions:[
         {
           name:"全部",
           id:1
         },
         {
           name:"门诊",
           id:2
         },
         {
           name:"住院",
           id:3
         }
       ],
       dosageOptions:[], //剂型选择
       usageOptions:[], //用法数据字典选择。
       footnoteOptions:[], //西药脚注数据字典选择
       frequencyOptions:[], //频次选择
       doseUnitOptions:[], //剂量单位
       spiritOptions:[],//精神药物等级  数据字典id为41
       prescriptionOptions:[],//处方等级(数据字典) id 为 42
       antibiosisOptions:[], //抗菌药物等级(数据字典) id为43
       narcoticOptions:[], //毒麻药物等级 数据字典id 为44
       preciousOptions:[],//贵重药物等级  数据字典id为45
       minPackOptions:[], //最小包装单位 数据字典id为69
       preparationOptions:[], //最小制剂单位 数据字典id为61
       informationFlag:false, //控制药品信息添加
       informationType:1, //添加编辑药品类型
       kindType:[], //药品种类选择
       drugClassFly:[], //药品分类选择
       is_otcType:[
         {
           label:"是",
           value:1
         },
         {
           label:"不是",
           value:2
         }
       ],
       is_skin_test:[
         {
           label:"是",
           value:1
         },
         {
           label:"否",
           value:2
         }
       ],
       pack_specificationType:[],
       informationId:"",
       diagnoseFlag:false,
       diagnoseType:1,
       diagnoseData:{
         code:"", //诊断代码
         name:"", //诊断名称 
         category:"", //诊断分类
       },
       treeData:[],
       ThreeId:1,
       threeType:1,
       threeFlag:false,
       tableDataThree:[],
       tableTitleThree:[
          {
            prop:"name",
            name:"字典名称",
            type:1,
          },
           {
            prop:"value",
            name:"字典值",
            type:1,
          },
          {
            prop:"listorder",
            name:"排序",
            type:1,
          },
          {
            prop:"",
            name:"操作",
            type:4,
            arr:[
               {
                type:"info",
                number:1,
                name:"编辑"
              },
              {
                type:"danger",
                number:2,
                name:"删除"
              },
            ]
          },
       ],
       threeFrom:{
         name:"", //字典名称
         group_id:"",  //分组ID
         value:"", //字典值
         listorder:'',
         id:"", //字典id值
       },
       catalogueString:"",
       zhxType:false
       
     }
   },
   mounted(){
     this.titleLabel = "药品单位名称"
     this.dialogTitle = "药品单位"
     this.getDrugUnitIndex()
     this.dict_dataGroupIndex()
     this.dict_dataDictIndexOne()
      this.getDrugTypeAll()
      this.getDrugSpeciesIndex(true)
            this.getCategoryIndex(true)
            this.service_feeCategoryIndex(true)
            this.getDrugUnitIndex(true)
            this.getDosageList(true)
   },
   watch:{
    activeName(to,key){
      console.log(to)
      if(to == 2){
       this.tableTitle = dictionary
       this.tableData = []
       this.tabData = []
       this.dict_dataGetDiseaseDict()
      //  this.hu
      }else if(to == 1){
       this.tableTitle = yaopin
       this.tableData = []
       this.tabData = []
       this.getDrugUnitIndex()
      }else if(to == 5){
              this.ybduima=true
      }
    },
    drugType(to,key){
      if(to == 'b3'){
       return  this.tableTitleBai=mzmtbTitle;
      }else if(to == 'b4'){
       return  this.tableTitleBai=bdffmlTitle;
      }
      if(to == 5){
        tabList[0].name = "序号"
        this.tabList = tabList
      }else if(to == 6){
        tabList[0].name = "耗材编码"
        this.tabList = tabList
      }else if(to == 9){
        this.tabList = serveTitle
      }
      if(to == 8){
        let a = this.tableTitle.splice(2, 0,
         {
          prop:"typeName",
          name:"药房类型",
          type:1,
         },
        );
      }
      if(key == 8){
         this.tableTitle.splice(2,1);
      }
      
      if(key == 13 || key == 14 || key == 16){
        this.tableTitle = yaopin
      }
      if(to == 13 || to == 14 || to == 16){
        this.tableTitle = qita
      }
      if(to == 17){
        this.tableTitle = yizhu
      }else{
        this.tableTitle = ypd
      }
      if (to==19) {
         this.tableTitle = xmz
      }else if(to==20){
        this.tableTitle=jjxm
      }else if(to==21){
        this.tabList=weicai
      }
      
      if(this.activeName == 1){
        if(to != 3 || to != 5 || to != 6 || to != 9 || to != 13 || to != 14 || to != 16){
          this.userCount = 0
        }
      }
      switch(to){
        case 1:
          this.titleLabel = "药品单位名称"
          this.dialogTitle = "药品单位"
        break
        case 2:
          this.titleLabel = "药品种类名称"
          this.dialogTitle = "药品种类"
        break
        case 3:
          this.titleLabel = "药品分类名称"
          this.dialogTitle = "药品种类"
        break
        case 5:
          this.dialogTitle = "药品信息"
        break
        case 6:
          this.titleLabel = "耗材字典名称"
          this.dialogTitle = "耗材字典"
        break
        case 7:
          this.titleLabel = "库房字典名称"
          this.dialogTitle = "库房字典"
        break
        case 8:
          this.titleLabel = "药房字典名称"
          this.titleSelectLabel = "选择药房类型"
          this.dialogTitle = "药房字典"
        break
        case 9:
          this.titleLabel = "药房字典名称"
          this.titleSelectLabel = "选择药房类型"
          this.dialogTitle = "药房字典"
        break
        case 10:
          this.titleLabel = "费用名称"
          this.titleSelectLabel = "选择费用种类"
          this.dialogTitle = "费用种类"
        break
        case 13:
          this.titleLabel = "剂型管理名称"
          this.dialogTitle = "剂型管理"
        break
        case 14:
          this.titleLabel = "给药途径名称"
          this.dialogTitle = "给药途径"
        break
        case 16:
          this.titleLabel = "频次管理名称"
          this.dialogTitle = "频次管理"
        break
        case 17:
          this.titleLabel = "医嘱术语内容"
          this.dialogTitle = "医嘱术语"
        break
         case 19:
          this.titleLabel = "组合项目内容"
          this.dialogTitle = "组合项目"
        break
      }
      
    }
   },
   methods:{
     
     handleTypeCheckBox(e){
        let str = ""
        e.forEach((item,key)=>{
          if(key == e.length - 1){
            str += item.id
          }else{
            str += item.id + ","
          }
        })
        this.catalogueString = str
     },
     handleRepeal(){
       backCateLog({goods_ids:this.catalogueString,begndate:new Date(),list_type:this.drugType == 5 ? 101 : this.drugType == 6 ? 301 : this.drugType == 9 ? 201 : ''})
       .then(res=>{
         this.$message({
          message:res.msg,
          type: 'success'
        });
       })
       .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
        });
       })
     },
     handleCtalog(){
       console.log(this.catalogueString)

       upCateLog({goods_ids:this.catalogueString,begndate:new Date(),list_type:this.drugType == 5 ? 101 : this.drugType == 6 ? 301 : this.drugType == 9 ? 201 : ''})
       .then(res=>{
         this.$message({
          message:res.msg,
          type: 'success'
        });
       })
       .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
        });
       })
     },
    service_feeExportService(){
      service_feeExportService()
      .then(res=>{
        window.open(http + '/' +res.data.file_url);
      }) 
      .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    // 导出药品
    drugExportDrug(e){
       drugExportDrug({type:e})
       .then(res=>{
          window.open(http + '/' +res.data.file_url);
       })
       .catch(e=>{
         this.$message({
          message:e.message,
          type: 'error'
        });
       })
      
    },
    //  导出
    handleDerive(){
      if(this.activeName == 1){
        switch(this.drugType){
          case 5:
           this.drugExportDrug(1)
          break
          case 6:
           this.drugExportDrug(2)
          break
          case 9:
           this.service_feeExportService()
          break
        }
      }

    },
    // 关闭
    handleCloseThree(){
      this.threeFlag = false
      this.routeType = false
    },
    //  activeName点击
    handleClick(e){
      this.activeName = e
      console.log(e)
      if(this.activeName == 3){
        this.handleClickList(1)
        this.dict_dataGroupIndex()
      }else if (this.activeName==4) {
         this.$router.push({path:'/system/downtext'})
    }else if(this.activeName==5){
         this.ybduima=true
    }
    },
    // 基础字典获取list
    handleClickList(e){
      dict_dataDictIndex({group_id:e,keyword:this.keyvalue})
      .then(res=>{
        this.tableDataThree = res.data[0].items
      })
      .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    // 基础字典分页
    handlePaginationThree(){

    },
    //  获取字典下面的字典值
    dict_dataDictIndexOne(){
       dict_dataDictIndex({group_id:"69"})
       .then(res=>{
         this.unitOptions = res.data[0].items
       })
       .catch(e=>{
         this.$message({
          message:e.message,
          type: 'error'
        });
       })
    },
    //  添加基础字典
    dict_dataStore(){
       if(this.threeFrom.name)
       dict_dataStore({...this.threeFrom})
       .then(res=>{
          this.$message({
            message:"添加成功",
            type: 'success'
          });
          this.tableDataThree = []
          this.handleClickList()
       })
       .catch(e=>{
         this.$message({
            message:e.message,
            type: 'error'
         });
       })
    },
    // 基础字典表单编辑
    handleEditOne(e){
      if(e.key == 1){
        this.threeType = 2
        this.threeFlag = true
        this.threeFrom = JSON.parse(JSON.stringify(e.data))
        
      }else if(e.key == 2){
        this.handleRemoveDict_dataDel(e.data.id)
      }
    },
    // 查询基础字典值
    handleInquire(){
      this.handleClickList(this.ThreeId)
    },
    // 添加基础字典
    dict_dataStore(){
     let data = {
        name:"",
        value:"",
        group_id:"",
        listorder:'',
      }
      Object.keys(data).forEach(key=>{
        data[key] = this.threeFrom[key]
      })
      if(data.name.length == 0){
        this.$message({
          message:"请输入字典名称",
          type: 'error'
        });
        return false
      }
      data.group_id = this.ThreeId
      dict_dataStore({...data})
      .then(res=>{
        this.$message({
          message:"添加成功",
          type: 'success'
        });
        Object.keys(this.threeFrom).forEach(key=>{
          this.$set(this.threeFrom,key,"")
        })
        this.threeFlag = false
        this.tableDataThree = []
        this.handleClickList(this.ThreeId)
      })
      .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    //  编辑基础字典
    dict_dataSave(){
      let data = {
        name:"",
        id:"",
        value:"",
         listorder:'',
      }
      Object.keys(data).forEach(key=>{
        data[key] = this.threeFrom[key]
      })
      if(data.name.length == 0){
        this.$message({
          message:"请输入字典名称",
          type: 'error'
        });
        return false
      }
      dict_dataSave({...data})
      .then(res=>{
         this.$message({
          message:"编辑成功",
          type: 'success'
        });
        Object.keys(this.threeFrom).forEach(key=>{
          this.$set(this.threeFrom,key,"")
        })
        this.threeFlag = false
        this.tableDataThree = []
        this.handleClickList(this.ThreeId)
      })
      .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    // 新增基础字典按钮事件
    handleAddOne(){
        this.threeType = 1
        this.threeFlag = true
    },
    // 基础字典点击树形结构事件
    handleNodeClickThree(e){
     
      this.ThreeId = e.id
      this.handleClickList(e.id)
    },
    // 删除基础字典值
    handleRemoveDict_dataDel(e){
      dict_dataDel({id:e})
      .then(res=>{
        this.$message({
          message:"删除成功",
          type: 'success'
        });
        this.tableDataThree = []
        this.handleClickList(this.ThreeId)
      })
      .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    // 获取树形数据字典
    dict_dataGroupIndex(){
      dict_dataGroupIndex()
      .then(res=>{
        this.treeData = res.data
        console.log(this.treeData)
      })  
      .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    // 获取药品信息添加的数据字典值
    getDrugTypeAll(e){
     dict_dataDictIndex({group_id:"12,41,42,43,44,45,60,61,70"})
     .then(res=>{
       this.footnoteOptions = res.data[0].items
       this.spiritOptions = res.data[1].items
       this.prescriptionOptions = res.data[2].items
       this.antibiosisOptions = res.data[3].items
       this.narcoticOptions = res.data[4].items
       this.preciousOptions = res.data[5].items
       this.doseUnitOptions = res.data[6].items
       this.preparationOptions = res.data[7].items
       this.minPackOptions = res.data[8].items
     })
     .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
        });
     })
    },
    //  添加药品字典
    handleInformationType(){
       let data = {
         name:"",
         species_id:"",
         category_id:"",
         fee_category_id:"",
         specification:"",
         dose_unit:"",
         dose:"",
         pack_specification:"",
       }
       Object.keys(data).forEach(key=>{
         data[key] = this.information[key]
       })
       if(!objectValueAllEmpty(data)){
        this.$message({
          message:"请您认证检查表单是否填写正确",
          type: 'error'
        });
        return false
       }
      
       if(this.informationType == 1){
        data = this.information
       }else{
        data = this.information
        data.id = this.informationId
       }
       drugDrugSave({...data})
       .then(res=>{
          this.$message({
            message:"操作成功",
            type: 'success'
          });
        
          this.limit = 10
      
          Object.keys(this.information).forEach(key=>{
            this.$set(this.information,key,"")
          })
          this.drugDrugIndex()
          this.informationFlag = false
       })
       .catch(e=>{
         this.$message({
            message:e.message,
            type: 'error'
         });
       })
    },
     //关闭药品字典编辑
     handleCloseInformation(){
      
        // this.limit = 10
      
        this.drugDrugIndex()
        // Object.keys(this.information).forEach(key=>{
        //     this.$set(this.information,key,"")
        // })
        this.informationFlag = false
     },
    //  查询按钮
     handleSizeChange(e){
       this.limit = e
       if(this.drugType == 5 || this.drugType == 6 || this.drugType == 9 || this.drugType == 10 || this.drugType == 13 || this.drugType == 14 || this.drugType == 16){
          this.tabData = []
          this.tableTitle = []
         this[this.InterfaceName[this.activeName-1][this.drugType]]() 
       }
     },
     
     handleProjectAdd(){
       let data = {
         type:"",
         name:"",
         category_id:"",
         unit:"",
         price:""
       }
       Object.keys(data).forEach(key=>{
         data[key] = this.projectData[key]
       })
       
       if(!objectValueAllEmpty(data)){
        this.$message({
          message:"请您认证检查表单是否填写正确",
          type: 'error'
        });
        return false
       }
       if(this.projectFType == 2){
         data = this.projectData
         data.id = this.projectId
       }else{
         data = this.projectData
       }
      
       service_feeSaveService({...data})
        .then(res=>{
          this.$message({
            message:"操作成功",
            type: 'success'
          });
       
          this.limit = 10
          // this.tabData = []
          this.projectFlag = false
          Object.keys(this.projectData).forEach(key=>{
            this.projectData[key] = ""
          })
          this.service_feeServiceIndex()
        })
        .catch(e=>{
          console.log(e)
          this.$message({
            message:e.message,
            type: 'error'
          });
        })

     },
     handleClosediagnose(){
       this.diagnoseFlag = false
     },
    //  执行科室
     cascaderChange(e){
       this.$set(this.projectData,"make_dept",e)
     },
    //  清空频次
     handleCloseCommnt(){
        Object.keys(this.commonValue).forEach(key=>{
          this.commonValue[key] = ""
        })
        this.commonFlag = false
     },
     getChronicDisease(){
        getChronicDisease({keyword:this.keyvalue,page:this.page,limit:this.limit})
        .then(res=>{
            if(res.data.list.length == 0){
              return false
            }
            res.data.list.map((item)=>{
              item.flag = item.status == 1 ? true : false
              return item
            })
            this.userCount = res.data.count
            this.tableData = this.tableData.concat(res.data.list)
        })
        .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
        })
     },
     handleCommonAdd(){
      if(!objectValueAllEmpty(this.commonValue)){
        this.$message({
          message:"请您认证检查表单是否填写正确",
          type: 'error'
        });
        return false
      }
      if(this.common == 1){
        commonCreatePinci({...this.commonValue})
        .then(res=>{
          this.$message({
            message:"修改成功",
            type: 'success'
          });
          this.tableData = []
          this.commonFlag = false
          this.getCommon()
       //  门诊慢特病
        })
        .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
        })
      }else if(this.common == 2){
        commonSavePinci({...this.commonValue,id:this.tableValue.id})
        .then(res=>{
          this.$message({
            message:"修改成功",
            type: 'success'
          });
          this.tableData = []
          this.commonFlag = false
          this.getCommon()
        })   
        .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
        }) 
      }
     },
     
     //  病种付费目录
     getDiseaseSpecieDict(){
        getDiseaseSpecieDict({keyword:this.keyvalue,page:this.page,limit:this.limit})
        .then(res=>{
            if(res.data.list.length == 0){
              return false
            }
            res.data.list.map((item)=>{
              item.flag = item.status == 1 ? true : false
              return item
            })
            this.userCount = res.data.count
            this.tableData = this.tableData.concat(res.data.list)
        })
        .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
        })
     },
     gdetCategoryIndex(){
        this[this.InterfaceName[this.activeName-1][this.drugType]]()  
     },
      //  树形结构点击
     handleNodeClickOne(e){
      //  console.log(" e.id", e.id)
      if(this.drugType == e.id){
        return false
      }
      this.drugType = e.id
      this.empty();  
      this.page = 1
      this.placeholderContent=e.id==='b3'?'请输入病种代码':(e.id==='b4'?'请输入目录代码':'请输入名称')
      switch(this.activeName){
        case 1:
          switch(e.id){
            case 5:
            case 9:
              this.species_id = ""
            break
            case 6:
             this.species_id = 3
             break
           }
        break
      }
       this[this.InterfaceName[this.activeName-1][this.drugType]]()  
     },
    //  分页
     handlePagination(e){
       console.log(e)
       this.page = e
       console.log(this.drugType)
       if(this.activeName == 1){
         switch(this.drugType){
          case 3:
            this.tableData = []
            this.getCategoryIndex()
          break
          case 5:
            this.tabData = []
            this.drugDrugIndex()
          break
          case 6:
            this.tabData = []
            this.drugDrugIndex()
          break
          case 9:
            this.tabData = []
            this.service_feeServiceIndex()
          break
          case 13:
            this.tableData = []
            this.getDosageList()
          break
          case 14:
            this.tableData = []
            this.getDrug_channel()
          break
          case 17:
            this.tableData = []
            this.doctor_entrustGetList()
          break
        }
       }else if(this.activeName == 2){
           this.tableData=[]; this.tabData = [];
           this[this.InterfaceName[this.activeName-1][this.drugType]]()  
       }
       
     },
     drugDrugShow(e){
       drugDrugShow({id:e})
       .then(res=>{
         console.log(res,"值")
         if(res.data.antibiosis == 0){
           res.data.antibiosis = ""
         }
         if(res.data.prescription == 0){
           res.data.prescription = ""
         }
         if(res.data.spirit == 0){
           res.data.spirit = ""
         }
         if(res.data.narcotic == 0){
           res.data.narcotic = ""
         }
         if(res.data.precious == 0){
           res.data.precious = ""
         }
         Object.keys(this.information).forEach(key=>{
           this.$set(this.information,key,res.data[key])
         })

         
       })
       .catch(e=>{
         this.$message({
            message:e.message,
            type: 'error'
         });
       })
     },
    //  switch分类
    handleSwitchChange(data){
      //  this.switchId = 
       let {data:list} = data
       if(this.activeName == 1){
         switch(this.drugType){
         case 1:
          getDrugUnitSet({id:list.id,status:list.status == 1 ? 2 : 1})
          .then(res=>{
            this.$message({
              message:"修改成功",
              type: 'success'
            });
            this.tableData = []
            this.getDrugUnitIndex()
          })
          .catch(e=>{
            this.$message({
              message:e.message,
              type: 'error'
            });
          })
         break
         case 2:
          getDrugSpeciesSet({id:list.id,status:list.status == 1 ? 2 : 1})
          .then(res=>{
            this.$message({
              message:"修改成功",
              type: 'success'
            });
            this.tableData = []
            this.getDrugSpeciesIndex()
          })
          .catch(e=>{
            this.$message({
              message:e.message,
              type: 'error'
            });
          })
         break
         case 3:
          getCategorySet({id:list.id,status:list.status == 1 ? 2 : 1})
          .then(res=>{
            this.$message({
              message:"修改成功",
              type: 'success'
            });
            this.tableData = []
            this.getCategoryIndex()
          })
          .catch(e=>{
            this.$message({
              message:e.message,
              type: 'error'
            });
          })
         break
         case 5:
          drugDrugSet({id:list.id,status:list.status == 1 ? 2 : 1})
          .then(res=>{
            this.$message({
              message:"修改成功",
              type: 'success'
            });
            this.tabData = []
            this.drugDrugIndex()
          })
          .catch(e=>{
            this.$message({
              message:e.message,
              type: 'error'
            });
          })
         break
         case 7:
          //  console.log(list.status)
          //  return false
          getDrug_storeSetStatus({id:list.id,status:list.status == 1 ? 2 : 1})
          .then(res=>{
            this.$message({
              message:"修改成功",
              type: 'success'
            });
            this.tableData = []
            this.getDrug_storeIndex()
          })
          .catch(e=>{
            this.$message({
              message:e.message,
              type: 'error'
            });
          })
         break
         case 8:
          getDrug_houseSetStatus({id:list.id,status:list.status == 1 ? 2 : 1})
          .then(res=>{
            this.$message({
              message:"修改成功",
              type: 'success'
            });
            this.tableData = []
            this.getDrug_house()
          })
          .catch(e=>{
            this.$message({
              message:e.message,
              type: 'error'
            });
          })
         break
         case 9:
           service_feeSetService({id:list.id,status:list.status == 1 ? 2 : 1})
           .then(res=>{
              this.$message({
              message:"修改成功",
              type: 'success'
            });
            this.tabData = []
            this.service_feeServiceIndex()
           })
           .catch(e=>{
             this.$message({
              message:e.message,
              type: 'error'
            });
           })
         break
         case 10:
            service_feeCategorySet({id:list.id,status:list.status == 1 ? 2 : 1})
            .then(res=>{
              this.$message({
                message:"修改成功",
                type: 'success'
              });
              this.tableData = []
              this.service_feeCategoryIndex()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
         break
         case 13:

         break
         }
       }else if(this.activeName == 2){
         if(this.drugType == 2){
          dict_dataSetDiseaseDict({id:list.id,status:list.status == 1 ? 2 : 1})
          .then(res=>{
            this.$message({
              message:"修改成功",
              type: 'success'
            });
            this.tableData = []
            this.dict_dataGetDiseaseDict()
          })
          .catch(e=>{
            this.$message({
              message:e.message,
              type: 'error'
            });
          })
         }
       }else{

       }
       
     },
     
    //  删除药品分类
    getCategoryDel(){
       getCategoryDel({id:this.tableValue.id})
       .then(res=>{
         this.$message({
            message:"删除成功",
            type: 'success'
          });
          this.classify = false
          this.tableData = []
          this.getCategoryIndex()
       })
       .catch(e=>{
         this.$message({
            message:e.message,
            type: 'error'
         });
       })
     },
    //  获取编辑点击按钮事件
    handleEdit(e){
      console.log(e)
       if(e.key == 1){
        if(this.activeName == 1){
          console.log("判断的现在在哪里",this.drugType)
          if(this.drugType == 8){
            this.classifyType = 2
            this.classify = true
            this.classIfyValue = e.data.name
            this.classSelect = e.data.type
          }else if(this.drugType == 5 || this.drugType==6){
            this.informationType = 2
            this.keyValueSelect = 1
         
            this.limit = 10
       
            this.drugDrugShow(e.data.id)
           
            this.getCommon(true)
            this.getDrug_channel(true)
            Object.keys(this.information).forEach(key=>{
              this.$set(this.information,key,e.data[key])
            })
            console.log(this.information)
            this.informationId = e.data.id
            this.informationFlag = true
          }else if(this.drugType == 9 ){
            this.projectFType = 2
            this.projectFlag = true
            this.proJectSelectId = e.data.make_dept
         
            this.limit = 10
            this.service_feeCategoryIndex(true)
            Object.keys(this.projectData).forEach(key=>{
              this.$set(this.projectData,key,e.data[key])
            })
            this.projectId = e.data.id
          }else if(this.drugType == 10){
            this.classifyType = 2
            this.classify = true
            this.pharmacySelect = e.data.type
            this.classIfyValue = e.data.name
          }else if(this.drugType == 16){
            this.common = 2
            Object.keys(this.commonValue).forEach(key=>{
              this.$set(this.commonValue,key,e.data[key])
            })
            this.commonFlag = true
          }else if(this.drugType == 14){
            this.routeType = true
            this.routeFlag = 2
             Object.keys(this.routeForm).forEach(key=>{
              this.$set(this.routeForm,key,e.data[key])
            })
          }else if(this.drugType==19){
               this.zhxForm.id=e.data.id
                this.selectData2=e.data.extra_json
                this.zhxForm.title=e.data.title
                this.zhxForm.remark=e.data.remark
                this.zhxType=true
          } else if(this.drugType==20){
            
            this.JJType = true
 
          }else if(this.drugType==21){
              this.projectFlag2=true
             this.projectData.id=e.data.id
              this.projectData=e.data
            // this.JJType = true
 
          }else {
            this.classifyType = 2
            this.classify = true
            this.classIfyValue = e.data.name
          }
          this.tableValue = e.data
        }else{
          if(this.drugType == 2){
            console.log(e.data)
            this.diagnoseFlag = true
            this.diagnoseType = 2
            Object.keys(e.data).forEach(key=>{
              this.$set(this.diagnoseData,key,e.data[key])
            })
          }
        }
       }else if(e.key == 2){
         console.log(e)
         this.tableValue = e.data

         switch(this.drugType){
           case 1:
           
             this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
             drugUnitDel({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
              this.tableData = []
              this.getDrugUnitIndex()
            })
          });
           break
           case 2:
           
             this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
              drugSpeciesDel({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
              this.tableData = []
              this.getDrugSpeciesIndex()
            })
          });
           break
           case 3:
           
              this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
               categoryDel({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
              this.tableData = []
              this.getCategoryIndex()
            })
          });
           break
           case 5:
           
             this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
              drugDrugDel({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
               this.tabData = []
               this.drugDrugIndex()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
          });
           break
             case 9:
           
                  this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
               delService({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
               this.tabData = []
               this.service_feeServiceIndex()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
          });
           break  
           case 13:
           
                  this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
               dosageDelete({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
               this.tableData = []
               this.getDosageList()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
          });
           break  
           case 14:
          
              this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
               drug_channelDelete({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
               this.tableData = []
               this.getDrug_channel()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
          });
           break
          case 16:
         
             this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
               deletePinci({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
               this.tableData = []
               this.getCommon()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
          });
           break
            case 17:
                    this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
             doctor_entrustDelete({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
              //  this.tableData = []
              //  this.getServiceGroup()
               this.doctor_entrustSave()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
          });
           
           break
              case 19:
                    this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
             deleteServiceGroup({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
               this.tableData = []
               this.getServiceGroup()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
          });
           
           break
                 case 20:
                    this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
             project_delete({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
               this.tableData = []
               this.project_getList()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
          });
           
           break
                    case 21:
                    this.$confirm("是否确认删除", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
             material_dict_unitDel({id:e.data.id})
            .then(res=>{
              this.$message({
                message:"删除成功",
                type: 'success'
              });
               this.tableData = []
               this.project_getList()
            })
            .catch(e=>{
              this.$message({
                message:e.message,
                type: 'error'
              });
            })
          });
           
           break
         }
         
       }
    },
    //  修改药品单位状态
     getDrugUnitSet(){
      
     },
    //  添加药品字典弹窗新增值
     handleAddThree(){
      if(this.threeType == 1) this.dict_dataStore()
      if(this.threeType == 2){
        this.dict_dataSave()
      }
     },
     handleAddRoute(){
        if(this.routeFlag == 1){
          this.drug_channelCreate()
        }else{
          this.drug_channelUpdate()
        }
     },
     drug_channelCreate(){
       drug_channelCreate({name:this.routeForm.name,type:this.routeForm.type})
       .then(res=>{
          this.$message({
            message:"添加成功",
            type: 'success'
          });
          this.tableData = []
          this.routeType = false
          Object.keys(this.routeForm).forEach((item,key)=>{
            this.$set(this.routeForm,key,"")
          })
          this.getDrug_channel()
       })
       .catch(e=>{
          this.routeType = false
          this.$message({
              message:e.message,
              type: 'error'
          });
       })
     },
     drug_channelUpdate(){
       drug_channelUpdate({name:this.routeForm.name,type:this.routeForm.type,id:this.routeForm.id})
       .then(res=>{
          this.$message({
            message:"删除成功",
            type: 'success'
          });
          this.tableData = []
          this.routeType = false
          Object.keys(this.routeForm).forEach((item,key)=>{
            this.$set(this.routeForm,key,"")
          })
          this.getDrug_channel()
       })
       .catch(e=>{
          this.routeType = false
          this.$message({
              message:e.message,
              type: 'error'
          });
       })
     },
    //  保存诊断字典
     dict_dataSaveDiseaseDict(){
      let data = this.diagnoseData
        if(!objectValueAllEmpty(data)){
          this.$message({
            message:"请您认真检查表单是否填写正确",
            type: 'error'
          });
          return false
        }
        if(this.classifyType == 2){
          data.id = this.tableValue.id
        }
        dict_dataSaveDiseaseDict({...data})
        .then(res=>{
            this.$message({
              message:this.classifyType == 1 ? '添加' : '编辑',
              type: 'success'
            });
            this.diagnoseFlag = false
            Object.keys(this.diagnoseData).forEach(key=>{
              this.$set(this.diagnoseData,key,"")
            })
            this.tableData = []
            this.dict_dataGetDiseaseDict()
        })
        .catch(e=>{
          this.$message({
              message:e.message,
              type: 'error'
          });
        })
     },
     addClick(){
       if(this.classIfyValue == ""){
         this.$message({
            message:"请输入需要添加或编辑的值",
            type: 'error'
          });
          return false
       }
       switch(this.drugType){
         case 1:
          this.getDrugUnitSave()
         break
         case 2:
          this.getDrugSpeciesSave()
         break
         case 3:
          this.getCategorySave()
         break
         case 7:
          this.getDrug_storeSave()
         break
         case 8:
          this.getDrug_houseSave()
         break
         case 10:
         
          this.service_feeCategorySave()
         break
         case 13:
          if(this.classifyType == 1){
            this.getDosageCreate()
          }else if(this.classifyType == 2){
            this.getDosageUpdate()
          }
         break
         case 14:
           if(this.classifyType == 1){
              this.drug_channelCreate()
           }else if(this.classifyType == 2){
              this.drug_channelUpdate()
           }
         break
         case 17:
          this.doctor_entrustSave()
         break

       }
     },
    //  费用分类列表
     service_feeCategoryIndex(e){
       service_feeCategoryIndex({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit})
        .then(res=>{
            if(res.data.length == 0){
              return false
            }
            res.data.map((item)=>{
              item.flag = item.status == 1 ? true : false
              return item
            })
            if(e) this.serviceOptions = res.data
            if(!e) this.tableData = this.tableData.concat(res.data)
        })
        .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
        })
     },
    //  费用分类保存
     service_feeCategorySave(){
        let data = {}
        if(this.classifyType == 1){
          data = {
            name:this.classIfyValue,
            type:this.pharmacySelect
          }
        }else if(this.classifyType == 2){
          data = {
            name:this.classIfyValue,
            id:this.tableValue.id,
            type:this.pharmacySelect
          }
        }
        service_feeCategorySave({...data})
        .then(res=>{
            this.$message({
              message:"添加成功",
              type: 'success'
            });
            this.classify = false
            this.classIfyValue = ""
            this.pharmacySelect = ""
            this.tableData = []
            this.service_feeCategoryIndex()
        })
        .catch(e=>{
          this.$message({
              message:e.message,
              type: 'error'
          });
        })
     },
    //  频次管理编辑
    commonSavePinci(){
        commonSavePinci({...data})
        .then(res=>{
            this.$message({
              message:"添加成功",
              type: 'success'
            });
            this.classify = false
            this.classIfyValue = ""
            this.tableData = []
            this.getCommon()
        })
        .catch(e=>{
          this.$message({
              message:e.message,
              type: 'error'
          });
        })
    },
    //  保存药品单位
     getDrugUnitSave(){
      let data = {}
        if(this.classifyType == 1){
          data = {
            name:this.classIfyValue
          }
        }else if(this.classifyType == 2){
          data = {
            name:this.classIfyValue,
            id:this.tableValue.id
          }
        }
        getDrugUnitSave({...data})
        .then(res=>{
            this.$message({
              message:"添加成功",
              type: 'success'
            });
            this.classify = false
            this.classIfyValue = ""
            this.tableData = []
            this.getDrugUnitIndex()
        })
        .catch(e=>{
          this.$message({
              message:e.message,
              type: 'error'
          });
        })
     },
    //  保存药物种类
     getDrugSpeciesSave(){
      let data = {}
        if(this.classifyType == 1){
          data = {
            name:this.classIfyValue
          }
        }else if(this.classifyType == 2){
          data = {
            name:this.classIfyValue,
            id:this.tableValue.id
          }
        }
        getDrugSpeciesSave({...data})
        .then(res=>{
            this.$message({
              message:"添加成功",
              type: 'success'
            });
            this.classify = false
            this.classIfyValue = ""
            this.tableData = []
            this.getDrugSpeciesIndex()
        })
        .catch(e=>{
          this.$message({
              message:e.message,
              type: 'error'
          });
        })
     },
     //保存药品分类
     getCategorySave(){
       let data = {}
       if(this.classifyType == 1){
         data = {
           name:this.classIfyValue
         }
       }else if(this.classifyType == 2){
         data = {
           name:this.classIfyValue,
           id:this.tableValue.id
         }
       }
       getCategorySave({...data})
       .then(res=>{
          this.$message({
            message:"添加成功",
            type: 'success'
          });
          this.classify = false
          this.classIfyValue = ""
          this.tableData = []
          this.getCategoryIndex()
       })
       .catch(e=>{
         this.$message({
            message:e.message,
            type: 'error'
         });
       })
     },
    //  清空
     empty(){
        this.page = 1
        this.tableData = []
        this.keyvalue = ""
        this.keyword = ""
        this.keyValueSelect = ""
     },
    //  树形结构点击
     handleNodeClick(e){
      // let loading        //定义loading变量
      // loading = Loading.service({
      //   lock: true,
      //   text: '加载中……',
      //   background: 'rgba(255,255,255, 0)'
      // })
      if(this.drugType == e.id){
        return false
      }
      this.category_id = ""
      this.drugType = e.id
      
      switch(this.activeName){
        case 1:
          switch(e.id){
            case 1:
              this.empty()
              this.getDrugUnitIndex()
            break
            case 2:
              this.empty()
              this.getDrugSpeciesIndex()
            break
            case 3:
              this.empty()
              this.getCategoryIndex()
              this.page = 1
            break
            case 4:
              this.empty()
              this.getCategoryIndex()
            break
            case 5:
              this.tabData = []
              this.keyvalue = ""
              this.species_id = ""
           
              this.keyValueSelect = ""
              this.drugDrugIndex()
            break
            case 6:
              this.tabData = []
              this.keyvalue = ""
              this.keyValueSelect = ""
              this.species_id = 3
            
              this.drugDrugIndex()
            break
            case 7:
              this.empty()
              this.getDrug_storeIndex()
            break
            case 8:
              this.empty()
              this.getDrug_house()
            break
            case 9:
              this.tabData = []
              this.keyvalue = ""
              this.keyValueSelect = ""
             
              this.service_feeCategoryIndex(true)
              this.service_feeServiceIndex()
            break
            case 10:
              this.empty()
              this.service_feeCategoryIndex()
            break
            case 13:
              this.empty()
              
              this.getDosageList()
            break 
            case 14:
              this.empty()
              
              this.getDrug_channel()
            break 
            case 15:
              this.empty()
              this.getDrug_channel()
            break 
            case 16:
              this.empty()
              this.getCommon()
            break
            case 17:
              this.empty()
              this.doctor_entrustGetList()
            break
             case 19:
              this.empty()
              this.service_feeServiceIndex()
              this.getServiceGroup()
            break
             case 20:
              this.empty()
           
           
              this.project_getList()
            break
             case 21:
              this.empty()
           
           
              this.material_dict_index()
            break
          }
        break
        case 2:
          switch(e.id){
            case 2:
             this.tableData = []
             this.keyvalue = ""
             this.keyValueSelect = ""
             this.dict_dataGetDiseaseDict()
            break
          }
        break
      }
     },
   
     
    //  关闭项目
     handleCloseProject(){
       this.projectFlag = false
     },
     //  新增分类
     handleAdd(){
       if(this.activeName == 1){
          if(this.drugType == 16){
            this.common = 1
            this.commonFlag = true
            Object.keys(this.commonValue).forEach(key=>{
                this.commonValue[key] = ""
            })
          }else if(this.drugType == 9){
            this.keyValueSelect = 1
            this.projectFType = 1
            this.service_feeCategoryIndex(true)
            Object.keys(this.projectData).forEach(key=>{
              this.$set(this.projectData,key,"")
            })
            this.projectFlag = true
          }else if(this.drugType == 5){
              this.informationType = 1
              this.keyValueSelect = 1
              
              this.limit = 10
              
              // this.getDrugSpeciesIndex(true)
              // this.getCategoryIndex(true)
              // this.service_feeCategoryIndex(true)
              // this.getDrugUnitIndex(true)
              // this.getDosageList(true)
             
              this.getCommon(true)
              this.getDrug_channel(true)
              this.informationFlag = true
          }else if(this.drugType == 6){
              this.informationType = 1
              this.keyValueSelect = 1
              
              this.limit = 10
              
              // this.getDrugSpeciesIndex(true)
              // this.getCategoryIndex(true)
              // this.service_feeCategoryIndex(true)
              // this.getDrugUnitIndex(true)
              // this.getDosageList(true)
             
              this.getCommon(true)
              this.getDrug_channel(true)
              this.informationFlag = true
          }else if(this.drugType == 14){
            this.routeType = true
            this.routeFlag = 1
          }else if(this.drugType == 19){
              this.zhxType=true
            console.log('00000')
          }else if(this.drugType == 20){
              this.JJType=true
            console.log('00000')
          } else if(this.drugType == 21){
              this.projectFlag2=true
            // console.log('00000')
          } else{
            this.classifyType = 1
            this.classify = true
          }
       }else{
         if(this.drugType == 2){
           this.diagnoseFlag = true
           this.diagnoseType = 1
         }
       }
     },
     handleClose(){
       this.classify = false
     },
     material_dict_index(){
        material_dict_index({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit,category_id:this.category_id}).then(res=>{
           this.userCount = res.data.count
         if(res.data.list.length == 0){
           return false
         }
         res.data.list.map((item)=>{
           item.flag = item.status == 1 ? true : false
          //  if(item.execute_dept){
          //    item.make_dept = item.execute_dept.id
          //  }
           if(item.category){
              item.categoryName = item.category.name
           }
          item.is_up=item.is_up==1?'已上传':'未上传'
           return item
         })

         this.tabData = res.data.list
    console.log(this.tabData)
       })
       .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });

        })
     },
     material_dict_save(){
          var d=this.projectData
          material_dict_save(d).then(res=>{
                console.log(res)
                if(res.code==200){
                     this.$message({
            message:"添加成功",
            type: 'success'
          });
                }
          })
     },
    //  项目字典
     service_feeServiceIndex(){
       service_feeServiceIndex({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit,category_id:this.category_id})
       .then(res=>{
         this.userCount = res.data.count
         if(res.data.list.length == 0){
           return false
         }
         res.data.list.map((item)=>{
           item.flag = item.status == 1 ? true : false
           if(item.execute_dept){
             item.make_dept = item.execute_dept.id
           }
           if(item.category){
              item.categoryName = item.category.name
           }
          item.is_up=item.is_up==1?'已上传':'未上传'
           return item
         })
         console.log(this.userCount)
         this.tabData = res.data.list
         this.selectData1= res.data.list
       })
       .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
       })
     },
     //  获取药品单位
     getDrugUnitIndex(e){
       getDrugUnitIndex({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit})
       .then(res=>{
         if(res.data.length == 0){
           return false
         }
         res.data.map((item)=>{
           item.flag = item.status == 1 ? true : false
           return item
         })
         this.userCount = res.data.length
         if(e){
           this.pack_specificationType = res.data
           console.log(this.pack_specificationType,"包装规格")
         }else{
           this.tableData = this.tableData.concat(res.data)
         }
         
       })
       .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
       })
     },
     //  获取药房分类
     getCategoryIndex(e){
       getCategoryIndex({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit})
       .then(res=>{
         if(res.data.list.length == 0){
           return false
         }
         res.data.list.map((item)=>{
           item.flag = item.status == 1 ? true : false
           return item
         })
         this.userCount = res.data.count
         if(e){
          this.drugClassFly = res.data.list
         }else{
          this.tableData = this.tableData.concat(res.data.list)
         }
         
       })
       .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
       })
     },
     //  获取药品种类
     getDrugSpeciesIndex(e){
       getDrugSpeciesIndex({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit})
       .then(res=>{
         if(res.data.length == 0){
           return false
         }
         res.data.map((item)=>{
           item.flag = item.status == 1 ? true : false
           return item
         })
         if(e){
          this.kindType = res.data
         }else{
          this.tableData = this.tableData.concat(res.data)
         }
         
       })
       .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
       })
     },
     project_getList(){
          project_getList().then(res=>{
            this.tableData=res.data
          })
     },
    //  获取剂型列表
     getDosageList(e){
      getDosageList({keyword:this.keyvalue,page:e?0:this.page,limit:e?1000:this.limit})
      .then(res=>{
          if(e){
            this.dosageOptions = res.data.list
          }else{
            if(res.data.list.length == 0){
            return false
          }
          res.data.list.map((item,key)=>{
            item.number = key + 1
            item.flag = item.status == 1 ? true : false
            return item
          })
            this.userCount = res.data.count
            this.tableData = this.tableData.concat(res.data.list)
          }
      })
      .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
         });
      })
     },
    //  给药途径列表
     getDrug_channel(e){
       getDrug_channel({keyword:this.keyvalue,page:e?1:this.page,limit:e?1000:this.limit})
      .then(res=>{
          if(res.data.list.length == 0){
            return false
          }
          if(e){
            this.usageOptions = res.data.list
          }else{
            res.data.list.map((item,key)=>{
              item.number = key + 1
              item.flag = item.status == 1 ? true : false
              return item
            })
            this.userCount = res.data.count
            this.tableData = this.tableData.concat(res.data.list)
          }
         
      })
      .catch(e=>{
        this.$message({
          message:e.message,
          type: 'error'
         });
      })
     },
    //  库房管理
     getDrug_storeIndex(){
       getDrug_storeIndex({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit})
        .then(res=>{

            if(res.data.length == 0){
              return false
            }
            res.data.map((item)=>{
              item.flag = item.status == 1 ? true : false
              return item
            })
            this.tableData = this.tableData.concat(res.data)
        })
        .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
        })
     },
    //  获取药房管理
     getDrug_house(){
        getDrug_house({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit})
        .then(res=>{
          console.log(res)
            if(res.data.length == 0){
              return false
            }
            res.data.map((item)=>{
              item.flag = item.status == 1 ? true : false
              item.typeName = item.type == 1 ? "门诊药房" :item.type == 2 ? '住院药房' : "统一药房"
              return item
            })

            this.tableData = this.tableData.concat(res.data)
        })
        .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
        })
     },
     //频次列表
     getCommon(e){
        getCommon({keyword:this.keyvalue,page:e?0:this.page,limit:e?1000:this.limit})
        .then(res=>{
          if(e){
            this.frequencyOptions = res.data
          }else{
            if(res.data.length == 0){
              return false
            }
            res.data.map((item)=>{
              item.flag = item.status == 1 ? true : false
              return item
            })
            this.tableData = this.tableData.concat(res.data)
          }
        })
        .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
        })    
     },
    //  保存库房
     getDrug_storeSave(){
       let data = {}
       if(this.classifyType == 1){
         data = {
           name:this.classIfyValue
         }
       }else if(this.classifyType == 2){
         data = {
           name:this.classIfyValue,
           id:this.tableValue.id
         }
       }
      //  库房
       getDrug_storeSave({...data})
       .then(res=>{
          this.$message({
            message:"添加成功",
            type: 'success'
          });
          this.classify = false
          this.classIfyValue = ""
          this.tableData = []
          this.getDrug_storeIndex()
       })
       .catch(e=>{
         this.$message({
            message:e.message,
            type: 'error'
         });
       })
     },
     //  保存药房
     getDrug_houseSave(){
       let data = {}
       if(this.classifyType == 1){
         data = {
           name:this.classIfyValue,
           type:this.classSelect
         }
       }else if(this.classifyType == 2){
         data = {
           name:this.classIfyValue,
           id:this.tableValue.id,
           type:this.classSelect
         }
       }
       getDrug_houseSave({...data})
       .then(res=>{
          this.$message({
            message:"添加成功",
            type: 'success'
          });
          this.classify = false
          this.classIfyValue = ""
          this.tableData = []
          this.getDrug_house()
       })
       .catch(e=>{
         this.$message({
            message:e.message,
            type: 'error'
         });
       })
     },
    //  诊断字典
     dict_dataGetDiseaseDict(){
        dict_dataGetDiseaseDict({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit})
        .then(res=>{
            if(res.data.list.length == 0){
              return false
            }
            res.data.list.map((item)=>{
              item.flag = item.status == 1 ? true : false
              return item
            })
            this.tableData = this.tableData.concat(res.data.list)
            this.userCount = res.data.count
            
        })
        .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
        })    
     },
    //
    //  修改剂型
    getDosageUpdate(){
      let data = {}
      console.log(this.classify)
       if(this.classifyType == 1){
         data = {
           name:this.classIfyValue
         }
       }else if(this.classifyType == 2){
         data = {
           name:this.classIfyValue,
           id:this.tableValue.id
         }
       }
      getDosageUpdate({...data})
      .then(res=>{
          this.$message({
            message:"修改成功",
            type: 'success'
          });
          this.classify = false
          this.classIfyValue = ""
          this.tableData = []
          this.getDosageList()
      })
      .catch(e=>{
        this.$message({
            message:e.message,
            type: 'error'
        });
      })
    },
    //  获取药品列表
    drugDrugIndex(){
       drugDrugIndex({keyword:this.keyvalue,status:this.keyValueSelect,page:this.page,limit:this.limit,species_id:this.species_id})
       .then(res=>{
         
           res.data.list.map((item,index)=>{
              item.flag = item.status == 1 ? true : false;
              item.index = index+1;
              item.is_up=item.is_up==1?'已上传':'未上传'
              return item
            })
          console.log("ddLLL::::",res.data.list);
            this.userCount = res.data.count
            this.tabData = res.data.list
       })
       .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
       })
    },
    //  创建剂型
    getDosageCreate(){
       let data = {}
       if(this.classifyType == 1){
         data = {
           name:this.classIfyValue
         }
       }else if(this.classifyType == 2){
         data = {
           name:this.classIfyValue,
           id:this.tableValue.id
         }
       }
       getDosageCreate({...data})
       .then(res=>{
          this.$message({
            message:"添加成功",
            type: 'success'
          });
          this.classify = false
          this.classIfyValue = ""
          this.tableData = []
          this.getDosageList()
       })
       .catch(e=>{
         this.$message({
            message:e.message,
            type: 'error'
         });
       })
    },
    //获取诊疗数据
    handleGetServiceItem(){
       handleGetServiceItem({keyword:this.keyvalue,page:this.page,limit:this.limit})
       .then(res=>{
           res.data.list.map((item)=>{
              item.flag = item.status == 1 ? true : false
              return item
            })
            this.userCount = res.data.count
            this.tabData = this.tabData.concat(res.data.list)
       })
       .catch(e=>{
          this.$message({
            message:e.message,
            type: 'error'
          });
       })
    },
    // 获取嘱托
    doctor_entrustGetList(){
      doctor_entrustGetList({page:this.page,limit:this.limit,keyword:this.keyvalue})
      .then(res=>{
        if(res.data.list.length == 0){
           return false
        }
        this.userCount = res.data.count
        this.tableData = this.tableData.concat(res.data.list)
      })
    },
    doctor_entrustSave(e){
      let data = {}
        if(this.classifyType == 1){
          data = {
            title:this.classIfyValue
          }
        }else if(this.classifyType == 2){
          data = {
            title:this.classIfyValue,
            id:this.tableValue.id
          }
        }
      doctor_entrustSave({...data})
      .then(res=>{
        this.$message({
          message:"添加成功",
          type: 'success'
        });
        this.classify = false
        this.tableData = []
        this.classIfyValue = ""
        this.doctor_entrustGetList()
      })
    },
    getServiceGroup(){
        getServiceGroup({keyword:this.keyvalue}).then(res=>{
          this.tableData=res.data
        })
    },
    xuanzeDatathree(row){
        var arr = JSON.parse(JSON.stringify(row));
      this.selectData2 = this.selectData2.concat(arr);
    },
      deleteRow(index, rows) {
      rows.splice(index, 1);
    },
    handxmz(){
      var  data=this.zhxForm
      var arr=[]
      for (let i = 0; i < this.selectData2.length; i++) {
        arr.push(this.selectData2[i].id)
        
      }
      data.pid=arr.toString()
        saveServiceGroup(data).then(res=>{
             if (res.code==200) {
               this.getServiceGroup()
               this.zhxType=false
             }
        })
    },
    handleCloseThree2(){
      this.selectData2=[]
      this.zhxForm={
        id:'',
        title:'',
        remark:'',
        pid:'',
      }
      this.zhxType=false
    },
     handleCloseThree3(){
    this.project_getList()
      this.JJType=false
    }
   },
   components:{
     FromList,
     choiceCascader,
     TopMenu,
       costRecord,
       cost
   }
}
</script>

<style lang="scss" scoped>
@import "./index.scss";
</style>